package com.atguigu.petstore.app.controller;

import com.atguigu.petstore.app.service.ShopService;
import com.atguigu.petstore.app.vo.ShopCategoryVo;
import com.atguigu.petstore.app.vo.ShopComprehensiveVo;
import com.atguigu.petstore.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lfy
 * @Description
 * @create 2023-09-28 10:17
 */
@Tag(name = "商品API")
@RestController
@RequestMapping("/app")
public class ShopController {


    @Autowired
    ShopService shopService;

    @Operation(summary = "获取商品分类")
    @GetMapping("/category")
    public Result getCategory(){


        List<ShopCategoryVo> shopCategoryVos = shopService.getCategory();

        return Result.ok(shopCategoryVos);
    }

    @Operation(summary = "获取综合数据")
    @GetMapping("/comprehensive")
    public Result getComprehensive(){


        ShopComprehensiveVo vo =  shopService.getComprehensive();


        return Result.ok(vo);
    }
}
